#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["DFGK_WMS.WebAPI/DFGK_WMS.WebAPI.csproj", "DFGK_WMS.WebAPI/"]
COPY ["DFGK.WMS.Commn/DFGK.WMS.Common.csproj", "DFGK.WMS.Commn/"]
COPY ["DFGK_WMS.Context/DFGK_WMS.Context.csproj", "DFGK_WMS.Context/"]
COPY ["DFGK_WMS.Model/DFGK_WMS.Model.csproj", "DFGK_WMS.Model/"]
COPY ["DFGK_WMS.IRepository/DFGK_WMS.IRepository.csproj", "DFGK_WMS.IRepository/"]
COPY ["DFGK_WMS.Repository/DFGK_WMS.Repository.csproj", "DFGK_WMS.Repository/"]
RUN dotnet restore "DFGK_WMS.WebAPI/DFGK_WMS.WebAPI.csproj"
COPY . .
WORKDIR "/src/DFGK_WMS.WebAPI"
RUN dotnet build "DFGK_WMS.WebAPI.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "DFGK_WMS.WebAPI.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "DFGK_WMS.WebAPI.dll"]